#ifndef FBOINSGRENDERER_H
#define FBOINSGRENDERER_H

#include <QtQuick/QQuickFramebufferObject>

class SimRenderer;

class FboInSGRenderer : public QQuickFramebufferObject
{
    Q_OBJECT

    Q_PROPERTY(bool play READ play WRITE setPlay NOTIFY playChanged)

public:
    FboInSGRenderer(QQuickItem *parent=0);
    virtual ~FboInSGRenderer();

    // Create the renderer
    Renderer *createRenderer() const;

    bool play() const;

    /*
     * // slots can be made Q_INVOKABLE too for QML-C++ communication
public slots:
    void cppSlot(const QString &msg) {
        qDebug() << "Called the C++ slot with message:" << msg;
    }*/

public Q_SLOTS:
    void setPlay(bool arg);

Q_SIGNALS:
    void playChanged();

protected:
    // Mouse handling
    virtual void mousePressEvent(QMouseEvent * event);
    virtual void wheelEvent(QWheelEvent *event);
    virtual void mouseMoveEvent(QMouseEvent *event);

private:
    // Mouse tracking
    double mAlpha;
    double mBeta;
    double mDistance;
    QPoint mLastMousePosition;

    // To access mAlpha, mBeta, mDistance for adjusting OpenGL view
    friend class SimRenderer;

};

#endif
